Skip to content

Patterns: Allow for filtering of block patterns by source#4697

Closed
aaronrobertshaw wants to merge 6 commits into
WordPress:trunkfrom
aaronrobertshaw:update/allow-pattern-filtering-by-source
Closed

Patterns: Allow for filtering of block patterns by source#4697
aaronrobertshaw wants to merge 6 commits into
WordPress:trunkfrom
aaronrobertshaw:update/allow-pattern-filtering-by-source

Conversation

@aaronrobertshaw

Copy link
Copy Markdown

This is a backport PR for WordPress 6.3 that includes the following PHP Gutenberg changes:

Trac ticket: https://core.trac.wordpress.org/ticket/58622


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

Comment thread src/wp-includes/block-patterns.php Outdated
Co-authored-by: Mukesh Panchal <mukeshpanchal27@users.noreply.github.com>
Comment thread src/wp-includes/block-patterns.php Outdated
'core/' . $core_block_pattern,
require __DIR__ . '/block-patterns/' . $core_block_pattern . '.php'
);
$pattern = require ABSPATH . WPINC . '/block-patterns/' . $core_block_pattern . '.php';

@talldan talldan Jun 26, 2023

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the path was only changed in the gutenberg plugin because the plugin is in a different directory.

No need to bring this change over to core.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for explaining that 👍

I did a brief check elsewhere in core and saw similar approaches in defining required paths, so mistakenly brought that over.

Comment thread src/wp-includes/block-patterns.php Outdated
require __DIR__ . '/block-patterns/' . $core_block_pattern . '.php'
);
$pattern = require ABSPATH . WPINC . '/block-patterns/' . $core_block_pattern . '.php';
$pattern['source'] = 'core'; // Added in 6.3.0.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 'Added in 6.3.0' comments are useful in the Gutenberg plugin, but not so useful here, so I think they can be removed.

@ramonjd ramonjd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I merged this into

Which has the latest Gutenberg packages

Functionality, as described in WordPress/gutenberg#51672 works well.

✅ Explore the library categories and ensure that only template parts, theme patterns, and reusable blocks are shown.

Screenshot 2023-06-27 at 7 51 59 pm

@tellthemachines

Copy link
Copy Markdown
Contributor

committed in r56063 / c27f776.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

5 participants